/*
 * Selling Partner API for Easy Ship
 *
 * Use the Selling Partner API for Easy Ship to build applications for sellers to manage and ship Amazon Easy Ship orders. With this API, you can get available time slots, schedule and reschedule Easy Ship orders, and print shipping labels, invoices, and warranties. To review the differences in Easy Ship operations by marketplace, refer to [Marketplace support](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support).
 *
 * The version of the OpenAPI document: 2022-03-23
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.easyship.v2022_03_23
{
    /// <summary>
    /// The request schema for the &#x60;createScheduledPackage&#x60; operation.
    /// </summary>
    [DataContract(Name = "CreateScheduledPackageRequest")]
    public partial class CreateScheduledPackageRequest : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateScheduledPackageRequest" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected CreateScheduledPackageRequest() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateScheduledPackageRequest" /> class.
        /// </summary>
        /// <param name="amazonOrderId">An Amazon-defined order identifier. Identifies the order that the seller wants to deliver using Amazon Easy Ship. (required).</param>
        /// <param name="marketplaceId">A string of up to 255 characters. (required).</param>
        /// <param name="packageDetails">packageDetails (required).</param>
        public CreateScheduledPackageRequest(string amazonOrderId = default(string), string marketplaceId = default(string), PackageDetails packageDetails = default(PackageDetails))
        {
            // to ensure "amazonOrderId" is required (not null)
            if (amazonOrderId == null)
            {
                throw new ArgumentNullException("amazonOrderId is a required property for CreateScheduledPackageRequest and cannot be null");
            }
            this.AmazonOrderId = amazonOrderId;
            // to ensure "marketplaceId" is required (not null)
            if (marketplaceId == null)
            {
                throw new ArgumentNullException("marketplaceId is a required property for CreateScheduledPackageRequest and cannot be null");
            }
            this.MarketplaceId = marketplaceId;
            // to ensure "packageDetails" is required (not null)
            if (packageDetails == null)
            {
                throw new ArgumentNullException("packageDetails is a required property for CreateScheduledPackageRequest and cannot be null");
            }
            this.PackageDetails = packageDetails;
        }

        /// <summary>
        /// An Amazon-defined order identifier. Identifies the order that the seller wants to deliver using Amazon Easy Ship.
        /// </summary>
        /// <value>An Amazon-defined order identifier. Identifies the order that the seller wants to deliver using Amazon Easy Ship.</value>
        [DataMember(Name = "amazonOrderId", IsRequired = true, EmitDefaultValue = true)]
        public string AmazonOrderId { get; set; }

        /// <summary>
        /// A string of up to 255 characters.
        /// </summary>
        /// <value>A string of up to 255 characters.</value>
        [DataMember(Name = "marketplaceId", IsRequired = true, EmitDefaultValue = true)]
        public string MarketplaceId { get; set; }

        /// <summary>
        /// Gets or Sets PackageDetails
        /// </summary>
        [DataMember(Name = "packageDetails", IsRequired = true, EmitDefaultValue = true)]
        public PackageDetails PackageDetails { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class CreateScheduledPackageRequest {\n");
            sb.Append("  AmazonOrderId: ").Append(AmazonOrderId).Append("\n");
            sb.Append("  MarketplaceId: ").Append(MarketplaceId).Append("\n");
            sb.Append("  PackageDetails: ").Append(PackageDetails).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // MarketplaceId (string) maxLength
            if (this.MarketplaceId != null && this.MarketplaceId.Length > 255)
            {
                yield return new ValidationResult("Invalid value for MarketplaceId, length must be less than 255.", new [] { "MarketplaceId" });
            }

            // MarketplaceId (string) minLength
            if (this.MarketplaceId != null && this.MarketplaceId.Length < 1)
            {
                yield return new ValidationResult("Invalid value for MarketplaceId, length must be greater than 1.", new [] { "MarketplaceId" });
            }

            yield break;
        }
    }

}
